﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gao.Poker.Domain;
using Gao.Poker.Services;

namespace Gao.Poker.Command
{
    public class TablesSaveCommand : BaseCommand
    {
        private readonly Action<Boolean, Tables> _action;

         public TablesSaveCommand(Action<Boolean, Tables> action)
        {
            _action = action;
        }


        public override void Execute(object parameter)
        {
            var tables = parameter as Tables;
            var tablesServices = new TablesService();
            var result = tablesServices.Save(tables);

            if (_action != null)
            {
                _action(result != null, result);
            }
        }
    }
}
